package com.demo.spring.beans.factory.config;

import com.demo.spring.beans.BeansException;
import com.demo.spring.beans.PropertyValues;

public interface InstantiationAwareBeanPostProcessor extends BeanPostProcessor {

    // 在对象初始化方法之前，执行此方法
    Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException;

    // 在Bean对象初始化方法之后，执行此方法
    boolean postProcessAfterInstantiation(Object object, String beanName) throws BeansException;

    // 在Bean对象实例化完成之后，执行此方法
    PropertyValues postProcessPropertyValues(PropertyValues pvs, Object bean, String beanName) throws BeansException;

    default Object getEarlyReference(Object bean, String beanName) {
        return bean;
    }

}
